package activity
import history.*

class Register {
    Serial serial
    Reader reader
    String goup//多場次報名的主要registerID
    String CID//身份證號
    String cancelCode
    String sysCode
    Date regTime
    String status
//合併下面三個欄位為status，狀態為其中之一，"正取報名","候補報名","候補補到","待審報名","報名審過","報名審拒","自行取消"
//    String standby//候補與否
//    String userCancel//使用者取消
//    String auditPass//審核通過與否
    String present = '未出席'
    History history
    Date lastUpdated
    
    static belongsTo = [event:Event]

    static constraints = {
        serial(nullable:true)
        reader(blank:false)
        event(blank:false)
        goup(nullable:true)
        CID(nullable:true)
        cancelCode(blank:false)
        sysCode(nullable:true)
        regTime(nullable:true)
        status(nullable:true,size:0..10,inList:["正取報名","候補報名","候補補到","待審報名","報名審過","報名審拒","自行取消"])
//        standby(inList:["Y","N"],nullable:true)//候補/正取/無為需審查
//        userCancel(inList:["Y"],nullable:true)//有/無
//        auditPass(inList:["Y","N"],nullable:true)//通過/待審/無為不需審查
        present(nullable:true,size:0..10,inList:["未出席","已出席","已簽退"])
        lastUpdated(nullable:true)
        history(nullable:true)
    }
    
    String toString() {
        if (reader) {
            reader.name
        } else {
            id
        }
    } 
}
